'use strict';

var firstQCController = require('../controllers/FirstQC.server.controller'),
    userController = require('../controllers/User.server.controller'),
    stationWorkController = require('../controllers/StationWork.server.controller'),
    workController = require('../controllers/Work.server.controller'),
    processController = require('../controllers/Process.server.controller'),
    productFlowController = require('../controllers/ProductFlow.server.controller'),
    produceWorkController = require('../controllers/ProduceWork.server.controller'),
    CoreController = require('../controllers/Core.server.controller'),
    BarcodeController = require('../controllers/Barcode.server.controller'),
    wrapperController = require('../controllers/Wrapper.server.controller'),
    kanbanController = require('../controllers/Kanban.server.controller'),
    judgeController = require('../controllers/Judge.server.controller'),
    packingStorageController = require('../controllers/PackingStorage.server.controller'),
    registerTerminalController = require('../controllers/RegisterTerminal.server.controller'),
    checkWorkController = require('../controllers/CheckWork.server.controller'),
    barcodeReplaceController = require('../controllers/BarcodeReplace.server.controller'),
    deliveryController = require('../controllers/Delivery.server.controller'),
    qualifyInspectionController = require('../controllers/QualifyInspection.server.controller'),
    tagPrintController = require('../controllers/TagPrint.server.controller'),
    homeController = require('../controllers/Home.server.controller');

var ItemMasterController = require('../controllers/ItemMasterSync.server.controller');
var MOController = require('../controllers/MOSync.server.controller');
var CompletePlanController = require('../controllers/CompletePlanSync.server.controller');


module.exports = function(app) {
    // 服务器连接测试接口
    app.route('/open/connectTest').post(CoreController.connectTest);
    app.route('/api/core/getSystemTime').post(CoreController.getSystemTime);
    // 首页服务
    app.route('/api/core/findAllBarcodeMasterByLotNum').post(CoreController.findAllBarcodeMasterByLotNum);
    app.route('/api/core/getBarcodeMasterByDate').post(CoreController.getBarcodeMasterByDate);
    app.route('/api/core/queryCompletionDaily').post(CoreController.queryCompletionDaily);
    app.route('/api/core/findDepartmentByCodeOrName').post(CoreController.findDepartmentByCodeOrName);

    //批次绑定
    app.route('/api/barcode/getAllMOInfo').post(BarcodeController.getAllMOInfo);
    app.route('/api/barcode/getMOLotNumber').post(BarcodeController.getMOLotNumber);
    app.route('/api/barcode/getBarcodeMaster').post(BarcodeController.findBarcodeMasterByBarcode);
    app.route('/api/barcode/findAssemblyRelationsByBarcodeMaster').post(BarcodeController.findAssemblyRelationsByBarcodeMaster);
    app.route('/api/barcode/MOLotNumberToAssemblyBarcode').post(BarcodeController.MOLotNumberToAssemblyBarcode);
    //交接检查
    app.route('/api/Kanban/getWareHouseByDepartment').post(kanbanController.getWareHouseByDepartment);
    app.route('/api/Kanban/getWareHouseByContainer').post(kanbanController.getWareHouseByContainer);
    app.route('/api/Kanban/getKanBanDemandInfo').post(kanbanController.getKanBanDemandInfo);
    app.route('/api/barcode/findBarcodeMaster').post(checkWorkController.getBarcodeData);
    app.route('/api/Kanban/getAllDepartment').post(kanbanController.getAllDepartment);
    app.route('/api/Kanban/getContainer').post(kanbanController.getContainer);
    app.route('/api/Kanban/getWareHouseByDepartment').post(kanbanController.getWareHouseByDepartment);

    app.route('/api/produceWork/queryRcvRecordsByBarcodeMaster').post(produceWorkController.queryRcvRecordsByBarcodeMaster);

    app.route('/api/FirstQC/getTerminalWorkLocationWorks').post(firstQCController.getTerminalWorkLocationWorks);
    app.route('/api/FirstQC/getFirstQCDefaultInfo').post(function(req, res) {
        firstQCController.getFirstQCDefaultInfo.call(firstQCController, req, res);
    });
    app.route('/api/FirstQC/setFirstQCInfo').post(firstQCController.setFirstQCInfo);
    app.route('/api/FirstQC/getBadType').post(firstQCController.getBadType);

    app.route('/api/User/getUserRoles').post(userController.getUserRoles);

    app.route('/api/Process/processScan').post(processController.processScan);
    app.route('/api/Process/insertBizRecordST').post(processController.insertBizRecordST);
    app.route('/api/Process/updateBizRecordST').post(processController.updateBizRecordST);

    app.route('/api/ProductFlow/getProductFlow').post(productFlowController.getProductFlow);

    app.route('/api/Wrapper/getWrapperInfo').post(wrapperController.getWrapperInfo);
    app.route('/api/Wrapper/setWrapperMeasure').post(wrapperController.setWrapperMeasure);

    app.route('/api/Kanban/createKanban').post(kanbanController.createKanban);
    app.route('/api/Kanban/queryConnectAreaByTerminal').post(kanbanController.queryConnectAreaByTerminal);
    app.route('/api/Kanban/GetUpStreamKanban').post(kanbanController.GetUpStreamKanban);
    app.route('/api/Kanban/GetDownStreamKanban').post(kanbanController.GetDownStreamKanban);
    app.route('/api/Kanban/PIckUp').post(kanbanController.PIckUp);
    app.route('/api/Kanban/Arrived').post(kanbanController.Arrived);
    app.route('/api/Kanban/queryTransferAreaByWork').post(kanbanController.queryTransferAreaByWork);
  
    app.route('/api/Kanban/submitDemandQty').post(kanbanController.submitDemandQty);

    app.route('/api/Kanban/getAllWareHouse').post(kanbanController.getAllWareHouse);
    app.route('/api/Kanban/queryKanbanData').post(kanbanController.queryKanbanData);

    app.route('/api/Judge/specialScanCode').post(judgeController.specialScanCode);
    app.route('/api/Judge/decideScanCode').post(judgeController.decideScanCode);
    app.route('/api/Judge/doJudge').post(judgeController.doJudge);
    app.route('/api/Judge/getSpecialMasters').post(judgeController.getSpecialMasters);
    app.route('/api/Judge/getDecideMasters').post(judgeController.getDecideMasters);
    app.route('/api/Judge/getExtendEnum').post(judgeController.getExtendEnum);

    app.route('/api/PackingStorage/getAssemblyBarcodeData').post(packingStorageController.getAssemblyBarcodeData);
    app.route('/api/PackingStorage/getLocationAndWork').post(packingStorageController.getLocationAndWork);
    app.route('/api/PackingStorage/doStocking').post(packingStorageController.doStocking);

    app.route('/api/RegisterTerminal/getStation').post(registerTerminalController.getStation);
    app.route('/api/RegisterTerminal/registerTerminal').post(registerTerminalController.registerTerminal);
    app.route('/api/RegisterTerminal/getLastRegister').post(registerTerminalController.getLastRegister);
    //检验作业
    app.route('/api/CheckWork/submitCheckWork').post(checkWorkController.submitCheckWork);
    app.route('/api/CheckWork/getBarcodeData').post(checkWorkController.getBarcodeData);
    app.route('/api/CheckWork/getBarcodeDataCheck').post(checkWorkController.getBarcodeDataCheck);
    app.route('/api/CheckWork/getBarcodeDefectData').post(checkWorkController.getBarcodeDefectData);
    app.route('/api/CheckWork/updateBadData').post(checkWorkController.updateBadData);
    app.route('/api/CheckWork/getIdType').post(checkWorkController.getIdType);
    app.route('/api/CheckWork/getExtendEnumByCode').post(checkWorkController.getExtendEnumByCode);

    //芯片更替
    app.route('/api/BarcodeReplace/getNewBarcodeData').post(barcodeReplaceController.getNewBarcodeData);
    app.route('/api/BarcodeReplace/submitBarcodeData').post(barcodeReplaceController.submitBarcodeData);

    app.route('/api/Delivery/getWareHouses').post(deliveryController.getWareHouses);
    app.route('/api/Delivery/getDeliveryRecords').post(deliveryController.getDeliveryRecords);
    app.route('/api/Delivery/updateDeliveryStatus').post(deliveryController.updateDeliveryStatus);

    //u9料品和工单、完工计划同步
    app.route('/api/ItemMaster/syncSaveItem').post(ItemMasterController.syncSaveItem);
    app.route('/api/ItemMaster/syncDeleteItem').post(ItemMasterController.syncDeleteItem);
    app.route('/api/MO/syncMOStart').post(MOController.syncMOStart);
    app.route('/api/MO/syncMOApprove').post(MOController.syncMOApprove);
    app.route('/api/MO/syncMOCancel').post(MOController.syncMOCancel);
    app.route('/api/CompletePlan/syncCompletePlanStart').post(CompletePlanController.syncCompletePlanStart);
    app.route('/api/CompletePlan/syncCompletePlanApprove').post(CompletePlanController.syncCompletePlanApprove);
    app.route('/api/CompletePlan/syncCompletePlanCancel').post(CompletePlanController.syncCompletePlanCancel);
    app.route('/api/CompletePlan/getCompletePlanByDate').post(CompletePlanController.getCompletePlanByDate);

    app.route('/api/QualifyInspection/scanCode').post(qualifyInspectionController.scanCode);
    app.route('/api/QualifyInspection/submit').post(qualifyInspectionController.submit);

    app.route('/api/TagPrint/submitTagPrint').post(tagPrintController.submitTagPrint);
    app.route('/api/TagPrint/updateTagPrint').post(tagPrintController.updateTagPrint);


    app.route('/api/Home/queryBizRecordRate').post(homeController.queryBizRecordRate);

    
    app.route('/api/barcode/queryDepartment').post(BarcodeController.queryDepartment);
    app.route('/api/barcode/queryWorkLocationByDepartment').post(BarcodeController.queryWorkLocationByDepartment);
    app.route('/api/barcode/countProductView').post(BarcodeController.countProductView);
    app.route('/api/barcode/queryRcvRecordsByContainer').post(BarcodeController.queryRcvRecordsByContainer);
    app.route('/api/barcode/queryRcvRecords').post(BarcodeController.queryRcvRecords);

};

